new Vue({
  el: '#app',
  data() {
    return {
      form1: {
        Group_SerialNumber: '',
        page: 1,			//页数
        limit: 10,			//每页数据条数
      },
      form: {},
      total: 0,
      category: [],
      Enterprise: [],
      Tags: [{
        name: '交易记录',
      }, {
        name: '交易公告',
      }],
      activeindex: 0,
      tableData: [],
      loading: false,
      Enterprise_Info_SerialNumber: $.cookie("enterprise"), 
      xiangqing:[]
    }
  },
  mounted() {
    this.form1.Group_SerialNumber = sessionStorage.getItem('Group_Transaction_SerialNumber')
    let Group_Purchasing_SerialNumber = sessionStorage.getItem('Group_Purchasing_SerialNumber')
    // console.log(this.form1.Group_Purchasing_SerialNumber)Group_Purchasing_SerialNumber
    //默认查询第一组数据
    // this.getList(this.form1)
    this.getData(Group_Purchasing_SerialNumber)
    this.getLog(this.form1)
  },
  methods: {
    active(i) {
      this.activeindex = i
    },
    getData(Group_Purchasing_SerialNumber) {
      let _this = this;
      $.ajax({
        url: DomainName + '/getGroupProcureIDAction',
        type: 'POST',
        data: {
          Group_Purchasing_SerialNumber,
          token: $.cookie("token")
        },
        success: function (res) {
          _this.form = res.Data

        }
      })
    },
    // //通过关键字查询数据
    // onSerach() {
    //   this.getList(this.form1)
    // },
    // //通过选择类别查询数据
    // change(e) {
    //   this.form1.Category_SerialNumber = e
    //   this.getList(this.form1)
    // },
    // //通过选择公司查询数据
    // change1(e) {
    //   this.form1.Enterprise_Info_SerialNumber = e
    //   this.getList(this.form1)
    // },
    //号码按键查询
    handleSizeChange(val) {
      this.form1.page = 1;
      this.form1.limit = val;
      this.getLog(this.form1)
    },
    //号码按键查询
    handleCurrentChange(val) {
      this.form1.page = val;
      this.getLog(this.form1)
    },
    //分页查询数据
    getList(data) {
      let _this = this
      $.ajax({
        type: 'POST',
        data,
        url: DomainName + '/getGroupTransactionAllAction',
        success: function (Result) {
          console.log('iiiiiiiiiiiiiiiiiiiiiiii',Result)
          _this.total = parseInt(Result.limit)
          _this.tableData = Result.tableData
          _this.tableData.forEach(item => {
            item.Quantity = item.Quantity + item.Article_Unit_SerialNumber
            item.Total_Quantity = item.Total_Quantity + item.Article_Unit_SerialNumber
          })
          // _this.form.Quantity = _this.form.Quantity + _this.form.Article_Unit_SerialNumber
          // _this.form.Total_Quantity = _this.form.Total_Quantity + _this.form.Article_Unit_SerialNumber
        },
        complete: function (XMLHttpRequest) {
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        dataType: "json"
      })
    },
    getLog(data){ 
      let _this = this;
      $.ajax({
        url: DomainName + '/getGroupOperationLog?token=' +$.cookie('token'),
        type: 'POST',
        data,
        success: function (res) {
          // console.log('操作日志',res)
          row=res.tableData
          _this.xiangqing=row
          console.log('操作日志',_this.xiangqing)
        }
      })
    }
  },
})

